function m = iniEnv(agt,t,type)
% initializes model environment
%
% revision 06102008
% tobias siegfried

switch type
    case 'rb'
        m.nStateV = 3; % 3 states: [resV; precip; tbInflow]
        m.state = zeros(m.nStateV,t.tEnd,agt.n); % stores x(t) for each agent in a 3D matrix
        % Runoff generation (SUPPLY)
        m.muS = 0; % runoff generator parameter (mean runoff) [m^3/s]
        m.rhoS = .99999; % lag 1 correlation for Markov process
        m.sigmaS = 50; % runoff generator parameter (standard deviation to be used for stochastic process)
        m.precipitation = generateRunoffTS(m,agt.n,t,1);
        % organize the states
        for n = 1 : agt.n
            m.state(2,:,n) = m.precipitation(:,n)';
            m.state(1,1,n) = agt.V0(n);
            m.state(3,1,n) = 0; % transboundary flow is zero.
        end
            
    case 'gw'
        
        
    otherwise
        disp('unknown model')
end